﻿using System;  
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using OnTheWay.Models;
using Models;
using BlackMofo.BLL;
using BlackMofo.BLL.Interfaces;

public delegate ServiceTransfer SoapAction();

// 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、服务和配置文件中的类名“Service”。
public class BlackMofoService : IBlackMofoService
{
    private static IsoDateTimeConverter timeConverter = null;

    static BlackMofoService()
    {
        timeConverter = ServiceTransfer.timeConverter;   
    }

    private string InvokeTransformException(SoapAction action, string method)
    {
        ServiceTransfer holder = null;
        try
        {
            holder = action.Invoke();
        }
        catch (Exception ex)
        {
            while(ex.InnerException != null){
                ex = ex.InnerException;
            }
            bool isnull = (ex.Message == null || ex.Message.Length == 0);
            string message = isnull ? ex.GetType().Name : ex.Message;
            if (ex.GetType() != typeof(Exception) || isnull)
            {
                message += "\r\n服务接口：" + method;
                message += "\r\n异常类型：" + ex.GetType().Name;
                message += "\r\n异常堆栈：" + ex.StackTrace;
            }
            holder = ServiceTransfer.FromException(new Exception(message));
        }
        return JsonConvert.SerializeObject(holder);
    }


    #region Exhibit服务接口实现

    IExhibitBLL ExhibitBLL = BLLFactory.ExhibitBLL;

    /// <summary>
    /// 增加一条数据
    /// </summary>
    /// <param name="model">待增加的对象</param>
    /// <returns>若添加成功，则返回 true；否则，返回false</returns>
    public string ExhibitInsert(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Exhibit model = JsonConvert.DeserializeObject<Exhibit>(smodel);
            bool ret = ExhibitBLL.Insert(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitInsert");
    }

    /// <summary>
    /// 更新一条数据
    /// </summary>
    /// <param name="model">待更新的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitUpdate(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Exhibit model = JsonConvert.DeserializeObject<Exhibit>(smodel);
            bool ret = ExhibitBLL.Update(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitUpdate");
    }

    /// <summary>
    /// 删除一条数据
    /// </summary>
    /// <param name="model">待删除的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitDelete(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Exhibit model = JsonConvert.DeserializeObject<Exhibit>(smodel);
            bool ret = ExhibitBLL.Delete(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitDelete");
    }

    /// <summary>
    /// 获取编号为 ID 的对象信息
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>编号为ID的对象</returns>
    public string ExhibitGetByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitBLL.GetByID(_authid, _id));
        }, "ExhibitGetByID");
    }

    /// <summary>
    /// 判断编号值为 ID 的对象是否存在
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>若编号为ID的对象存在，则返回 true；否则，返回false</returns>
    public string ExhibitExists(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitBLL.Exists(_authid, _id));
        }, "ExhibitExists");
    }

    /// <summary>
    /// 更新数据列表
    /// </summary>
    /// <param name="list">待更新的对象模型列表</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitUpdateList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<Exhibit> list = JsonConvert.DeserializeObject<List<Exhibit>>(slist);
            return ServiceTransfer.FromReturnValue(ExhibitBLL.UpdateList(_authid, list));
        }, "ExhibitUpdateList");
    }

    /// <summary>
    /// 删除 list 中列出的一批数据
    /// </summary>
    /// <param name="list">删除数据列表</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string ExhibitDeleteList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<Exhibit> list = JsonConvert.DeserializeObject<List<Exhibit>>(slist);
            return ServiceTransfer.FromReturnValue(ExhibitBLL.DeleteList(_authid, list));
        }, "ExhibitDeleteList");

    }

    /// <summary>
    /// 删除编号为 ID 一条数据
    /// </summary>
    /// <param name="ID">要删除的对象的编号</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string ExhibitDeleteByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitBLL.DeleteByID(_authid, _id));
        }, "ExhibitDeleteByID");
    }

    /// <summary>
    /// 判断 ID=id 的对象是否存在
    /// </summary>
    /// <param name="ID">id</param>
    /// <returns>若名称为Name的对象存在，则返回 true；否则，返回false</returns>
    public string ExhibitGetRecordCount(string authid, string where)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromReturnValue(ExhibitBLL.GetRecordCount(_authid, where));
        }, "ExhibitGetRecordCount");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitGetListByPage(string authid, string where, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(ExhibitBLL.GetListByPage(_authid, where, page));
        }, "ExhibitGetListByPage");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="order">排序字段</param>
    /// <param name="order">升序或倒序</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitGetListWhere(string authid, string where, string order, string asc)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(ExhibitBLL.GetListWhere(_authid, where, order, asc));
        }, "ExhibitGetListWhere");
    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitGetInValidData(string authid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(ExhibitBLL.GetInValidData(_authid));
        }, "ExhibitGetInValidData");

    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitGetInValidDataPage(string authid, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(ExhibitBLL.GetInValidDataPage(_authid, page));
        }, "ExhibitGetInValidDataPage");
    }

    #endregion //end Exhibit相关接口实现

    #region ExhibitType服务接口实现

    IExhibitTypeBLL ExhibitTypeBLL = BLLFactory.ExhibitTypeBLL;

    /// <summary>
    /// 增加一条数据
    /// </summary>
    /// <param name="model">待增加的对象</param>
    /// <returns>若添加成功，则返回 true；否则，返回false</returns>
    public string ExhibitTypeInsert(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            ExhibitType model = JsonConvert.DeserializeObject<ExhibitType>(smodel);
            bool ret = ExhibitTypeBLL.Insert(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitTypeInsert");
    }

    /// <summary>
    /// 更新一条数据
    /// </summary>
    /// <param name="model">待更新的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitTypeUpdate(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            ExhibitType model = JsonConvert.DeserializeObject<ExhibitType>(smodel);
            bool ret = ExhibitTypeBLL.Update(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitTypeUpdate");
    }

    /// <summary>
    /// 删除一条数据
    /// </summary>
    /// <param name="model">待删除的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitTypeDelete(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            ExhibitType model = JsonConvert.DeserializeObject<ExhibitType>(smodel);
            bool ret = ExhibitTypeBLL.Delete(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitTypeDelete");
    }

    /// <summary>
    /// 获取编号为 ID 的对象信息
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>编号为ID的对象</returns>
    public string ExhibitTypeGetByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitTypeBLL.GetByID(_authid, _id));
        }, "ExhibitTypeGetByID");
    }

    /// <summary>
    /// 判断编号值为 ID 的对象是否存在
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>若编号为ID的对象存在，则返回 true；否则，返回false</returns>
    public string ExhibitTypeExists(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitTypeBLL.Exists(_authid, _id));
        }, "ExhibitTypeExists");
    }

    /// <summary>
    /// 更新数据列表
    /// </summary>
    /// <param name="list">待更新的对象模型列表</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitTypeUpdateList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<ExhibitType> list = JsonConvert.DeserializeObject<List<ExhibitType>>(slist);
            return ServiceTransfer.FromReturnValue(ExhibitTypeBLL.UpdateList(_authid, list));
        }, "ExhibitTypeUpdateList");
    }

    /// <summary>
    /// 删除 list 中列出的一批数据
    /// </summary>
    /// <param name="list">删除数据列表</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string ExhibitTypeDeleteList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<ExhibitType> list = JsonConvert.DeserializeObject<List<ExhibitType>>(slist);
            return ServiceTransfer.FromReturnValue(ExhibitTypeBLL.DeleteList(_authid, list));
        }, "ExhibitTypeDeleteList");

    }

    /// <summary>
    /// 删除编号为 ID 一条数据
    /// </summary>
    /// <param name="ID">要删除的对象的编号</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string ExhibitTypeDeleteByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitTypeBLL.DeleteByID(_authid, _id));
        }, "ExhibitTypeDeleteByID");
    }

    /// <summary>
    /// 判断 ID=id 的对象是否存在
    /// </summary>
    /// <param name="ID">id</param>
    /// <returns>若名称为Name的对象存在，则返回 true；否则，返回false</returns>
    public string ExhibitTypeGetRecordCount(string authid, string where)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromReturnValue(ExhibitTypeBLL.GetRecordCount(_authid, where));
        }, "ExhibitTypeGetRecordCount");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitTypeGetListByPage(string authid, string where, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(ExhibitTypeBLL.GetListByPage(_authid, where, page));
        }, "ExhibitTypeGetListByPage");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="order">排序字段</param>
    /// <param name="order">升序或倒序</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitTypeGetListWhere(string authid, string where, string order, string asc)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(ExhibitTypeBLL.GetListWhere(_authid, where, order, asc));
        }, "ExhibitTypeGetListWhere");
    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitTypeGetInValidData(string authid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(ExhibitTypeBLL.GetInValidData(_authid));
        }, "ExhibitTypeGetInValidData");

    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitTypeGetInValidDataPage(string authid, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(ExhibitTypeBLL.GetInValidDataPage(_authid, page));
        }, "ExhibitTypeGetInValidDataPage");
    }

    #endregion //end ExhibitType相关接口实现

    #region ExhibitUnit服务接口实现

    IExhibitUnitBLL ExhibitUnitBLL = BLLFactory.ExhibitUnitBLL;

    /// <summary>
    /// 增加一条数据
    /// </summary>
    /// <param name="model">待增加的对象</param>
    /// <returns>若添加成功，则返回 true；否则，返回false</returns>
    public string ExhibitUnitInsert(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            ExhibitUnit model = JsonConvert.DeserializeObject<ExhibitUnit>(smodel);
            bool ret = ExhibitUnitBLL.Insert(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitUnitInsert");
    }

    /// <summary>
    /// 更新一条数据
    /// </summary>
    /// <param name="model">待更新的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitUnitUpdate(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            ExhibitUnit model = JsonConvert.DeserializeObject<ExhibitUnit>(smodel);
            bool ret = ExhibitUnitBLL.Update(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitUnitUpdate");
    }

    /// <summary>
    /// 删除一条数据
    /// </summary>
    /// <param name="model">待删除的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitUnitDelete(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            ExhibitUnit model = JsonConvert.DeserializeObject<ExhibitUnit>(smodel);
            bool ret = ExhibitUnitBLL.Delete(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "ExhibitUnitDelete");
    }

    /// <summary>
    /// 获取编号为 ID 的对象信息
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>编号为ID的对象</returns>
    public string ExhibitUnitGetByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitUnitBLL.GetByID(_authid, _id));
        }, "ExhibitUnitGetByID");
    }

    /// <summary>
    /// 判断编号值为 ID 的对象是否存在
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>若编号为ID的对象存在，则返回 true；否则，返回false</returns>
    public string ExhibitUnitExists(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitUnitBLL.Exists(_authid, _id));
        }, "ExhibitUnitExists");
    }

    /// <summary>
    /// 更新数据列表
    /// </summary>
    /// <param name="list">待更新的对象模型列表</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string ExhibitUnitUpdateList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<ExhibitUnit> list = JsonConvert.DeserializeObject<List<ExhibitUnit>>(slist);
            return ServiceTransfer.FromReturnValue(ExhibitUnitBLL.UpdateList(_authid, list));
        }, "ExhibitUnitUpdateList");
    }

    /// <summary>
    /// 删除 list 中列出的一批数据
    /// </summary>
    /// <param name="list">删除数据列表</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string ExhibitUnitDeleteList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<ExhibitUnit> list = JsonConvert.DeserializeObject<List<ExhibitUnit>>(slist);
            return ServiceTransfer.FromReturnValue(ExhibitUnitBLL.DeleteList(_authid, list));
        }, "ExhibitUnitDeleteList");

    }

    /// <summary>
    /// 删除编号为 ID 一条数据
    /// </summary>
    /// <param name="ID">要删除的对象的编号</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string ExhibitUnitDeleteByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(ExhibitUnitBLL.DeleteByID(_authid, _id));
        }, "ExhibitUnitDeleteByID");
    }

    /// <summary>
    /// 判断 ID=id 的对象是否存在
    /// </summary>
    /// <param name="ID">id</param>
    /// <returns>若名称为Name的对象存在，则返回 true；否则，返回false</returns>
    public string ExhibitUnitGetRecordCount(string authid, string where)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromReturnValue(ExhibitUnitBLL.GetRecordCount(_authid, where));
        }, "ExhibitUnitGetRecordCount");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitUnitGetListByPage(string authid, string where, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(ExhibitUnitBLL.GetListByPage(_authid, where, page));
        }, "ExhibitUnitGetListByPage");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="order">排序字段</param>
    /// <param name="order">升序或倒序</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitUnitGetListWhere(string authid, string where, string order, string asc)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(ExhibitUnitBLL.GetListWhere(_authid, where, order, asc));
        }, "ExhibitUnitGetListWhere");
    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitUnitGetInValidData(string authid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(ExhibitUnitBLL.GetInValidData(_authid));
        }, "ExhibitUnitGetInValidData");

    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string ExhibitUnitGetInValidDataPage(string authid, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(ExhibitUnitBLL.GetInValidDataPage(_authid, page));
        }, "ExhibitUnitGetInValidDataPage");
    }

    #endregion //end ExhibitUnit相关接口实现

    #region SysAdmin服务接口实现

    ISysAdminBLL SysAdminBLL = BLLFactory.SysAdminBLL;

    /// <summary>
    /// 增加一条数据
    /// </summary>
    /// <param name="model">待增加的对象</param>
    /// <returns>若添加成功，则返回 true；否则，返回false</returns>
    public string SysAdminInsert(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            SysAdmin model = JsonConvert.DeserializeObject<SysAdmin>(smodel);
            bool ret = SysAdminBLL.Insert(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "SysAdminInsert");
    }

    /// <summary>
    /// 更新一条数据
    /// </summary>
    /// <param name="model">待更新的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string SysAdminUpdate(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            SysAdmin model = JsonConvert.DeserializeObject<SysAdmin>(smodel);
            bool ret = SysAdminBLL.Update(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "SysAdminUpdate");
    }

    /// <summary>
    /// 删除一条数据
    /// </summary>
    /// <param name="model">待删除的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string SysAdminDelete(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            SysAdmin model = JsonConvert.DeserializeObject<SysAdmin>(smodel);
            bool ret = SysAdminBLL.Delete(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "SysAdminDelete");
    }

    /// <summary>
    /// 获取编号为 ID 的对象信息
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>编号为ID的对象</returns>
    public string SysAdminGetByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(SysAdminBLL.GetByID(_authid, _id));
        }, "SysAdminGetByID");
    }

    /// <summary>
    /// 判断编号值为 ID 的对象是否存在
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>若编号为ID的对象存在，则返回 true；否则，返回false</returns>
    public string SysAdminExists(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(SysAdminBLL.Exists(_authid, _id));
        }, "SysAdminExists");
    }

    /// <summary>
    /// 更新数据列表
    /// </summary>
    /// <param name="list">待更新的对象模型列表</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string SysAdminUpdateList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<SysAdmin> list = JsonConvert.DeserializeObject<List<SysAdmin>>(slist);
            return ServiceTransfer.FromReturnValue(SysAdminBLL.UpdateList(_authid, list));
        }, "SysAdminUpdateList");
    }

    /// <summary>
    /// 删除 list 中列出的一批数据
    /// </summary>
    /// <param name="list">删除数据列表</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string SysAdminDeleteList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<SysAdmin> list = JsonConvert.DeserializeObject<List<SysAdmin>>(slist);
            return ServiceTransfer.FromReturnValue(SysAdminBLL.DeleteList(_authid, list));
        }, "SysAdminDeleteList");

    }

    /// <summary>
    /// 删除编号为 ID 一条数据
    /// </summary>
    /// <param name="ID">要删除的对象的编号</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string SysAdminDeleteByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(SysAdminBLL.DeleteByID(_authid, _id));
        }, "SysAdminDeleteByID");
    }

    /// <summary>
    /// 判断 ID=id 的对象是否存在
    /// </summary>
    /// <param name="ID">id</param>
    /// <returns>若名称为Name的对象存在，则返回 true；否则，返回false</returns>
    public string SysAdminGetRecordCount(string authid, string where)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromReturnValue(SysAdminBLL.GetRecordCount(_authid, where));
        }, "SysAdminGetRecordCount");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string SysAdminGetListByPage(string authid, string where, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(SysAdminBLL.GetListByPage(_authid, where, page));
        }, "SysAdminGetListByPage");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="order">排序字段</param>
    /// <param name="order">升序或倒序</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string SysAdminGetListWhere(string authid, string where, string order, string asc)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(SysAdminBLL.GetListWhere(_authid, where, order, asc));
        }, "SysAdminGetListWhere");
    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string SysAdminGetInValidData(string authid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(SysAdminBLL.GetInValidData(_authid));
        }, "SysAdminGetInValidData");

    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string SysAdminGetInValidDataPage(string authid, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(SysAdminBLL.GetInValidDataPage(_authid, page));
        }, "SysAdminGetInValidDataPage");
    }

    #endregion //end SysAdmin相关接口实现

    #region User服务接口实现

    IUserBLL UserBLL = BLLFactory.UserBLL;

    /// <summary>
    /// 增加一条数据
    /// </summary>
    /// <param name="model">待增加的对象</param>
    /// <returns>若添加成功，则返回 true；否则，返回false</returns>
    public string UserInsert(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            User model = JsonConvert.DeserializeObject<User>(smodel);
            bool ret = UserBLL.Insert(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "UserInsert");
    }

    /// <summary>
    /// 更新一条数据
    /// </summary>
    /// <param name="model">待更新的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string UserUpdate(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            User model = JsonConvert.DeserializeObject<User>(smodel);
            bool ret = UserBLL.Update(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "UserUpdate");
    }

    /// <summary>
    /// 删除一条数据
    /// </summary>
    /// <param name="model">待删除的对象模型</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string UserDelete(string authid, string smodel)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            User model = JsonConvert.DeserializeObject<User>(smodel);
            bool ret = UserBLL.Delete(_authid, model);
            return ServiceTransfer.FromReturnValue(ret);
        }, "UserDelete");
    }

    /// <summary>
    /// 获取编号为 ID 的对象信息
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>编号为ID的对象</returns>
    public string UserGetByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(UserBLL.GetByID(_authid, _id));
        }, "UserGetByID");
    }

    /// <summary>
    /// 判断编号值为 ID 的对象是否存在
    /// </summary>
    /// <param name="ID">对象编号</param>
    /// <returns>若编号为ID的对象存在，则返回 true；否则，返回false</returns>
    public string UserExists(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(UserBLL.Exists(_authid, _id));
        }, "UserExists");
    }

    /// <summary>
    /// 更新数据列表
    /// </summary>
    /// <param name="list">待更新的对象模型列表</param>
    /// <returns>若更新成功，则返回 true；否则，返回false</returns>
    public string UserUpdateList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<User> list = JsonConvert.DeserializeObject<List<User>>(slist);
            return ServiceTransfer.FromReturnValue(UserBLL.UpdateList(_authid, list));
        }, "UserUpdateList");
    }

    /// <summary>
    /// 删除 list 中列出的一批数据
    /// </summary>
    /// <param name="list">删除数据列表</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string UserDeleteList(string authid, string slist)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            List<User> list = JsonConvert.DeserializeObject<List<User>>(slist);
            return ServiceTransfer.FromReturnValue(UserBLL.DeleteList(_authid, list));
        }, "UserDeleteList");

    }

    /// <summary>
    /// 删除编号为 ID 一条数据
    /// </summary>
    /// <param name="ID">要删除的对象的编号</param>
    /// <returns>若删除成功，则返回 true；否则，返回false</returns>
    public string UserDeleteByID(string authid, string sid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Guid _id = JsonConvert.DeserializeObject<Guid>(sid);
            return ServiceTransfer.FromReturnValue(UserBLL.DeleteByID(_authid, _id));
        }, "UserDeleteByID");
    }

    /// <summary>
    /// 判断 ID=id 的对象是否存在
    /// </summary>
    /// <param name="ID">id</param>
    /// <returns>若名称为Name的对象存在，则返回 true；否则，返回false</returns>
    public string UserGetRecordCount(string authid, string where)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromReturnValue(UserBLL.GetRecordCount(_authid, where));
        }, "UserGetRecordCount");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string UserGetListByPage(string authid, string where, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(UserBLL.GetListByPage(_authid, where, page));
        }, "UserGetListByPage");
    }

    /// <summary>
    /// 获取满足指定条件的数据列表
    /// </summary>
    /// <param name="where">指定查询条件</param>
    /// <param name="order">排序字段</param>
    /// <param name="order">升序或倒序</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string UserGetListWhere(string authid, string where, string order, string asc)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(UserBLL.GetListWhere(_authid, where, order, asc));
        }, "UserGetListWhere");
    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string UserGetInValidData(string authid)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            return ServiceTransfer.FromListValue(UserBLL.GetInValidData(_authid));
        }, "UserGetInValidData");

    }

    /// 获取无效数据
    /// </summary>
    /// <param name="page">分页对象</param>
    /// <returns>满足指定条件的数据列表</returns>
    public string UserGetInValidDataPage(string authid, string spage)
    {
        return InvokeTransformException(() =>
        {
            Guid _authid = JsonConvert.DeserializeObject<Guid>(authid);
            Page page = JsonConvert.DeserializeObject<Page>(spage);
            return ServiceTransfer.FromListValue(UserBLL.GetInValidDataPage(_authid, page));
        }, "UserGetInValidDataPage");
    }

    #endregion //end User相关接口实现
}
